package mephisto.services.impl;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;

import mephisto.services.IDatabaseService;

public class MySqlDatabaseService implements IDatabaseService {

    String dburl, user, password;
    
    public MySqlDatabaseService(String url, String user, String password) throws Exception {
        super();
        String driver = "com.mysql.jdbc.Driver";
        Class.forName(driver).newInstance();
        dburl = url;
        this.user = user;
        this.password = password;
    }
    
    public Connection getConnection() throws SQLException {
        
        Properties props = new Properties();
        props.put("user", user);
        props.put("password", password);
        Connection conn = DriverManager.getConnection(dburl, props);
        
        return conn;
    }
    
    
}
